import 'package:built_collection/built_collection.dart';
import 'package:equatable/equatable.dart';

part 'learning_interval.dart';
part 'learning_session.dart';

class LearningInfo extends Equatable {
  const LearningInfo({
    required this.learningSessions,
    this.currentLearningIntervalStartTime,
    this.currentLearningIntervalLastKnownActivityTime,
  });

  final BuiltList<LearningSession> learningSessions;
  final DateTime? currentLearningIntervalStartTime;
  final DateTime? currentLearningIntervalLastKnownActivityTime;

  @override
  List<Object?> get props {
    return [
      learningSessions,
      currentLearningIntervalStartTime,
      currentLearningIntervalLastKnownActivityTime,
    ];
  }

  LearningInfo copyWith({
    BuiltList<LearningSession> Function()? learningSessions,
    DateTime? Function()? currentLearningIntervalStartTime,
    DateTime? Function()? currentLearningIntervalLastKnownActivityTime,
  }) {
    return LearningInfo(
      learningSessions: learningSessions == null ? this.learningSessions : learningSessions(),
      currentLearningIntervalStartTime: currentLearningIntervalStartTime == null
          ? this.currentLearningIntervalStartTime
          : currentLearningIntervalStartTime(),
      currentLearningIntervalLastKnownActivityTime: currentLearningIntervalLastKnownActivityTime == null
          ? this.currentLearningIntervalLastKnownActivityTime
          : currentLearningIntervalLastKnownActivityTime(),
    );
  }
}
